package cn.zyq.charging.cost.dao.repository.impl;

import cn.zyq.charging.cost.dao.mapper.CostRuleMapper;
import cn.zyq.charging.cost.dao.repository.CostRuleRepository;
import cn.zyq.charging.cost.pojo.po.CostRulePO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * 调用CostRuleMapper继承自MyBatisPlus的selectList()方法根据充电站id从mysql查询计价规则数据。
 */
@Repository
public class CostRuleRepositoryImpl  implements CostRuleRepository {

    @Autowired
    private CostRuleMapper costRuleMapper;

    public List<CostRulePO> getCostRuleByStationId(Integer stationId) {
        QueryWrapper<CostRulePO> queryWrapper = new QueryWrapper<CostRulePO>();
        queryWrapper.eq("station_id",stationId);
        return costRuleMapper.selectList(queryWrapper);
    }
}